//
//  MagazineCollectionViewCell.m
//  HelpThePoor
//
//  Created by van7ish on 2016/12/6.
//  Copyright © 2016年 van7ish. All rights reserved.
//

#import "MagazineCollectionViewCell.h"

@implementation MagazineCollectionViewCell

- (UIImageView *)coverImageView{
    if (!_coverImageView) {
        _coverImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.width * 1.4)];
        
    }
    return _coverImageView;
}

- (UILabel *)titleLabel{
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.coverImageView.frame), self.coverImageView.frame.size.width, (self.frame.size.height - self.coverImageView.frame.size.height) / 3 * 2)];

        _titleLabel.font = FONTSIZE(15);
        _titleLabel.numberOfLines = 2;
        _titleLabel.textColor = COLOR_FONTGRAY;
        _titleLabel.textAlignment = NSTextAlignmentCenter;
        _titleLabel.adjustsFontSizeToFitWidth = YES;
        
    }
    return _titleLabel;
}

- (UILabel *)authorLabel{
    if (!_authorLabel) {
        _authorLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.titleLabel.frame), self.coverImageView.frame.size.width, self.titleLabel.frame.size.height / 3)];
        
        _authorLabel.textColor = COLOR_FONTLIGHTGRAY;
        _authorLabel.textAlignment = NSTextAlignmentCenter;
        _authorLabel.font = FONTSIZE(13);
        
    }
    return _authorLabel;
}

- (void)layoutSubviews{
    [super layoutSubviews];
    
    [self.contentView addSubview:self.coverImageView];
    [self.contentView addSubview:self.titleLabel];
    [self.contentView addSubview:self.authorLabel];
    
}


@end
